#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <pthread.h>
#include "common.h"
#include "log.h"


int iloginfo(const char* pinformat, ...)
{
    FILE*	fp = NULL;
	va_list	args;
	char sfilename[QUART_K_SIZE];
	
	memset(sfilename, 0, QUART_K_SIZE);
	sprintf(sfilename, "Thread_%lu.log", pthread_self());
	va_start(args, pinformat);
	if((fp = fopen(sfilename, "a+")) != NULL) {
		vfprintf(fp, pinformat, args);
		fclose(fp);
		fflush(fp);
		
		return 0;
	} else
		return errno;
}